package geom;


/**
 * This class represents an (x, y) coordinate within some space.
 * 
 * @author Robert c. Duvall
 */
public class Coordinate extends java.awt.geom.Point2D
{
    private java.awt.geom.Point2D.Double myPoint;


    public Coordinate ()
    {
        this(0, 0);
    }

    public Coordinate (double x, double y)
    {
        myPoint = new java.awt.geom.Point2D.Double(x, y);
    }

    public Coordinate (Coordinate other)
    {
        this(other.getX(), other.getY());
    }


    public double getX ()
    {
        return myPoint.getX();
    }

    public double getY ()
    {
        return myPoint.getY();
    }

    public boolean equals (Coordinate other)
    {
        return myPoint.equals(other);
    }
    
    
    public void setLocation (double x, double y)
    {
        myPoint.setLocation(x, y);
    }

    public String toString ()
    {
        return getClass().getName() + 
               "[x=" + getX() + ",y=" + getY() + "]";
    }
}
